Skip to content

[hellojoyworldz] WEEK 01 solutions#2663

Merged
DaleSeo merged 7 commits into
DaleStudy:mainfrom
hellojoyworldz:main
Jun 27, 2026
Merged

[hellojoyworldz] WEEK 01 solutions#2663
DaleSeo merged 7 commits into
DaleStudy:mainfrom
hellojoyworldz:main

Conversation

@hellojoyworldz

@hellojoyworldz hellojoyworldz commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

답안 제출 문제

작성자 체크 리스트

  • Projects의 오른쪽 버튼(▼)을 눌러 확장한 뒤, Week를 현재 주차로 설정해주세요.
  • 문제를 모두 푸시면 프로젝트에서 StatusIn Review로 설정해주세요.
  • 코드 검토자 1분 이상으로부터 승인을 받으셨다면 PR을 병합해주세요.

검토자 체크 리스트

Important

본인 답안 제출 뿐만 아니라 다른 분 PR 하나 이상을 반드시 검토를 해주셔야 합니다!

  • 바로 이전에 올라온 PR에 본인을 코드 리뷰어로 추가해주세요.
  • 본인이 검토해야하는 PR의 답안 코드에 피드백을 주세요.
  • 토요일 전까지 PR을 병합할 수 있도록 승인해주세요.

@dalestudy

dalestudy Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

📊 hellojoyworldz 님의 학습 현황

이번 주 제출 문제

문제 난이도 유형 분석
contains-duplicate Easy ✅ 의도한 유형
house-robber Medium ✅ 의도한 유형
longest-consecutive-sequence Medium ⚠️ 유형 불일치
top-k-frequent-elements Medium ✅ 의도한 유형
two-sum Easy ⚠️ 유형 불일치

누적 학습 요약

  • 풀이한 문제: 0 / 75개
  • 이번 주 유형 일치율: 60% (5문제 중 3문제 일치)

문제 풀이 현황

카테고리 진행도 완료
Array □□□□□□□ 0 / 10 ← 아직 시작 안 함
Binary □□□□□□□ 0 / 5 ← 아직 시작 안 함
Dynamic Programming □□□□□□□ 0 / 11 ← 아직 시작 안 함
Graph □□□□□□□ 0 / 8 ← 아직 시작 안 함
Interval □□□□□□□ 0 / 5 ← 아직 시작 안 함
Linked List □□□□□□□ 0 / 6 ← 아직 시작 안 함
Matrix □□□□□□□ 0 / 4 ← 아직 시작 안 함
String □□□□□□□ 0 / 10 ← 아직 시작 안 함
Tree □□□□□□□ 0 / 14 ← 아직 시작 안 함
Heap □□□□□□□ 0 / 3 ← 아직 시작 안 함

🤖 이 댓글은 GitHub App을 통해 자동으로 작성되었습니다.

🔢 API 사용량 (gpt-5-nano)
요청 입력 토큰 출력 토큰 합계 비용
1 1,096 154 1,250 $0.000116
2 1,096 144 1,240 $0.000112
3 1,096 142 1,238 $0.000112
4 1,335 181 1,516 $0.000139
5 1,669 275 1,944 $0.000193
6 1,669 200 1,869 $0.000163
7 1,668 224 1,892 $0.000173
8 1,666 271 1,937 $0.000192
9 1,669 223 1,892 $0.000173
10 1,668 230 1,898 $0.000175
합계 14,632 2,044 16,676 $0.001549

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🏷️ 알고리즘 패턴 분석

  • 패턴: Hash Map / Hash Set, Greedy
  • 설명: 집합(set)을 이용해 중복 여부를 빠르게 확인하는 방식으로 해시 맵/해시 셋 패턴에 해당하며, 추가적인 탐색 없이 중복 여부를 한 번에 판단하는 간단한 해결책이다.

📊 시간/공간 복잡도 분석

ℹ️ 이 파일에는 2가지 풀이가 포함되어 있어 각각 분석합니다.

풀이 1: Solution.containsDuplicate — Time: O(n) / Space: O(n)
복잡도
Time O(n)
Space O(n)

피드백: 집합을 이용해 각 원소를 한 번씩 확인하면서 중복 여부를 확인한다.

개선 제안: 현재 구현이 적절해 보입니다.

풀이 2: containsDuplicate_alternative — Time: O(n log n) / Space: O(1)
복잡도
Time O(n log n)
Space O(1)

피드백: 정렬으로 중복 여부를 판단하므로 시간 복잡도가 증가한다.

개선 제안: 현재 구현이 더 효율적이므로 대안 필요 없음.

💡 풀이에 시간/공간 복잡도를 주석으로 남겨보세요!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🏷️ 알고리즘 패턴 분석

  • 패턴: Dynamic Programming, Greedy
  • 설명: 이 코드는 인접한 집을 건너뛰며 최대 이익을 구하는 DP 점화식을 간단한 두 변수로 최적화한 방식이다. 각 위치의 최댓값을 이전 두 상태로 업데이트하는 슬라이딩 DP 패턴이 포함된다.

📊 시간/공간 복잡도 분석

복잡도
Time O(n)
Space O(1)

피드백: 피보나치형 DP를 with two variables로 구현해 공간을 최소화했다.

개선 제안: 현재 구현이 적절해 보입니다.

💡 풀이에 시간/공간 복잡도를 주석으로 남겨보세요!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🏷️ 알고리즘 패턴 분석

  • 패턴: Dynamic Programming, Sorting
  • 설명: 주어진 코드는 중복 제거 후 정렬으로 연속 증가 구간의 길이를 측정한다. 정렬과 연속 구간의 비교로 끝점까지의 길이를 누적하는 패턴이 핵심으로 보인다.

📊 시간/공간 복잡도 분석

ℹ️ 이 파일에는 2가지 풀이가 포함되어 있어 각각 분석합니다.

풀이 1: Solution.longestConsecutive — Time: O(n log n) / Space: O(n)
복잡도
Time O(n log n)
Space O(n)

피드백: 정렬이 주된 시간 복잡도이며, 중복 제거로 불필요한 비교를 줄인다.

개선 제안: 현재 구현이 명확하고 합리적이다.

풀이 2: longestConsecutive_optimized — Time: O(n) / Space: O(n)
복잡도
Time O(n)
Space O(n)

피드백: 해시셋을 이용하면 최악의 경우 O(n) 시간에 근접한 성능을 낼 수 있다.

개선 제안: 고려해볼 만한 개선 방향: 해시 기반 구현으로 시간 복잡도 개선 가능.

💡 풀이에 시간/공간 복잡도를 주석으로 남겨보세요!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🏷️ 알고리즘 패턴 분석

  • 패턴: Hash Map / Hash Set, Greedy
  • 설명: Counter를 사용해 각 원소의 빈도수를 세고, 가장 많이 등장한 k개를 반환한다. 해시 맵 기반 빈도 계산과 빈도 높은 원소 선별로 구성된 간단한 패턴이다.

📊 시간/공간 복잡도 분석

복잡도
Time O(n log n)
Space O(n)

피드백: 내장 자료구조를 활용해 구현이 간단하고 명확하다.

개선 제안: 현재 구현이 적합해 보입니다.

💡 풀이에 시간/공간 복잡도를 주석으로 남겨보세요!

Comment thread two-sum/hellojoyworldz.py

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🏷️ 알고리즘 패턴 분석

  • 패턴: Brute Force, Two Pointers
  • 설명: 이 코드는 모든 쌍을 탐색하는 이중 루프로 두 원소의 합이 타깃이 되는지를 확인하는 전형적인 브루트 포스 패턴입니다. 다만 Two Pointers로 간주되려면 정렬 후 양 끝 포인터를 이동하는 방식이 필요합니다.

📊 시간/공간 복잡도 분석

복잡도
Time O(n^2)
Space O(1)

피드백: 비효율적이므로 해시맵을 사용한 선형 시간 풀이가 일반적이다.

개선 제안: 고려해볼 만한 대안: 해시맵을 이용한 O(n) 풀이로 개선.

💡 풀이에 시간/공간 복잡도를 주석으로 남겨보세요!

@seueooo seueooo self-requested a review June 27, 2026 13:22
Comment on lines +7 to +17
class Solution:
def rob(self, nums: List[int]) -> int:
prev1 = 0
prev2 = 0

for num in nums:
current = max(prev1, prev2 + num)
prev2 = prev1
prev1 = current

return prev1

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dp 점화식을 변수로 두니까 공간복잡도가 많이 줄어드네요👍

Comment thread two-sum/hellojoyworldz.py
Comment on lines +7 to +16
class Solution:
def twoSum(self, nums: List[int], target: int) -> List[int]:
for first_index, first_num in enumerate(nums):
for second_index, second_num in enumerate(nums):
if first_index == second_index:
continue
if first_num + second_num == target:
return [first_index, second_index]

return []

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for문 중첩으로 시간복잡도가 높은데, 해시맵으로 개선하는 것도 좋을 것 같아요👍

@DaleSeo DaleSeo merged commit aaaa784 into DaleStudy:main Jun 27, 2026
1 check passed
@github-project-automation github-project-automation Bot moved this from Solving to Completed in 리트코드 스터디 8기 Jun 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Completed

Development

Successfully merging this pull request may close these issues.

3 participants